Using multi-GPUs in compute canada
Multi-gpu Interactive Job and Using Jupyter
ssh to compute canada from WSL terminal
ssh vannary@cedar.computecanada.caCreate virtual env in cc.
module load python/3.8virtualenv <Virtual Env Name>
Activate your vitual env.
source <Virtual Env Name>/bin/activate
Install Jupyter on Compute Canada.
pip install notebookpip install jupyterlab
Create a wrapper script to launch jupyter notebooks or lab.
echo -e '#!/bin/bash\nunset XDG_RUNTIME_DIR\njupyter notebook --ip $(hostname -f) --no-browser' > $VIRTUAL_ENV/bin/notebook.shchmod u+x $VIRTUAL_ENV/bin/notebook.shecho -e '#!/bin/bash\nunset XDG_RUNTIME_DIR\njupyter lab --ip $(hostname -f) --no-browser' > $VIRTUAL_ENV/bin/lab.shchmod u+x $VIRTUAL_ENV/bin/lab.sh
Submit an interactive job.
salloc --gpus-per-node=v100l:4 --time=1:00:00 --ntasks=1 --mem=10G --nodes=1
Run the
notebook.shorlab.shto start a notebook or JupyterLab.$VIRTUAL_ENV/bin/notebook.sh$VIRTUAL_ENV/bin/lab.shhttp://cdr544.int.cedar.computecanada.ca:8888/?token=7ed7059fad64446f837567e3 └────────────────┬───────────────────┘ └──────────┬───────────┘ hostname:port token
On new wsl terminal, run
ssh -L 8888:<hostname:port> your-username@cedar.computecanada.caGo to your web browser, type
localhost:8888/?token=<token>To watch GPU memory allocation in real time, type
watch -n 1 nvidia-smiin the terminal.
Testing Multi-gpus with Fastai in Jupyter notebook
- Install the following library inside your virtual env (need to be python 3.8 or greater)
pip install torchpip install fastaipip install wandbpip install pathlibpip install accelerate